/**
 * 防抖函数
 * @param func 需要执行的方法
 * @param wait 方法延迟
 */
export function debounce(func: any, wait: number) {
	let timeout: any
	return function executedFunction(...args: any[]) {
		const later = () => {
			clearTimeout(timeout)
			timeout = null
			func(...args)
		}
		clearTimeout(timeout)
		timeout = setTimeout(later, wait)
	}
}
